package com.kingdee.eas.minghua.contract.app;

import org.apache.log4j.Logger;
import javax.ejb.*;
import java.rmi.RemoteException;
import com.kingdee.bos.*;
import com.kingdee.bos.util.BOSObjectType;
import com.kingdee.bos.metadata.IMetaDataPK;
import com.kingdee.bos.metadata.rule.RuleExecutor;
import com.kingdee.bos.metadata.MetaDataPK;
//import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.bos.framework.ejb.AbstractEntityControllerBean;
import com.kingdee.bos.framework.ejb.AbstractBizControllerBean;
//import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.dao.IObjectValue;
import com.kingdee.bos.dao.IObjectCollection;
import com.kingdee.bos.service.ServiceContext;
import com.kingdee.bos.service.IServiceContext;

import java.lang.String;
import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.common.client.SysContext;
import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.bos.metadata.entity.SelectorItemCollection;
import com.kingdee.eas.framework.CoreBaseCollection;
import com.kingdee.eas.framework.SystemEnum;
import com.kingdee.eas.minghua.contract.TOxiaonguanxieyCollection;
import com.kingdee.eas.minghua.contract.TOxiaonguanxieyFactory;
import com.kingdee.eas.framework.CoreBillBaseCollection;
import com.kingdee.eas.framework.CoreBaseInfo;
import com.kingdee.eas.minghua.contract.TOxiaonguanxieyInfo;
import com.kingdee.eas.minghua.jczlwh.mj.SfshEnum;
import com.kingdee.eas.minghua.material.ClcghtDocFactory;
import com.kingdee.eas.minghua.material.ClcghtDocInfo;
import com.kingdee.eas.framework.app.CoreBillBaseControllerBean;
import com.kingdee.eas.framework.ObjectBaseCollection;

public class TOxiaonguanxieyControllerBean extends AbstractTOxiaonguanxieyControllerBean
{
    private static Logger logger =
        Logger.getLogger("com.kingdee.eas.minghua.contract.app.TOxiaonguanxieyControllerBean");

	
	
	protected boolean _audit(Context ctx, String audit) throws BOSException {
		try {
			TOxiaonguanxieyInfo Clc =  TOxiaonguanxieyFactory.getLocalInstance(ctx).getTOxiaonguanxieyInfo(new ObjectUuidPK(audit));
			if(Clc.getDjstage().equals(SfshEnum.shenhez)){
			Clc.setAuditor(SysContext.getSysContext().getCurrentUserInfo());
			Clc.setDjstage(SfshEnum.yes);
			SelectorItemCollection sel = new SelectorItemCollection();
		    sel.add("djstage");
		    TOxiaonguanxieyFactory.getLocalInstance(ctx).updatePartial(Clc, sel);
			}
		} catch (EASBizException e) {
			e.printStackTrace();
		}
		return super._audit(ctx, audit);
	}



	@Override
	protected boolean _unaudit(Context ctx, String unaudit) throws BOSException {
		// TODO Auto-generated method stub
		 
		 
		try {
			TOxiaonguanxieyInfo TO=TOxiaonguanxieyFactory.getLocalInstance(ctx).getTOxiaonguanxieyInfo(new ObjectUuidPK(unaudit));
		    if(TO.getDjstage().equals(SfshEnum.yes)){
			TO.setDjstage(SfshEnum.save);
		    SelectorItemCollection Sel=new SelectorItemCollection();
		    Sel.add("djstage");
		    TOxiaonguanxieyFactory.getLocalInstance(ctx).updatePartial(TO, Sel);
		    }
		} catch (EASBizException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	
		   return super._unaudit(ctx, unaudit);
	}
}